package com.kongge.formlike.service.rule;

import java.util.List;

/**
 * author:kongge
 * date:2018/7/23
 * layout:
 * description:
 */

public abstract class AbsRule implements IRule {

    private String ruleName;

    protected String errorMsg;

    @Override
    public void setParam(List<Object> paramList) {
        // 解析第二个参数，默认是错误提示
        if (paramList != null && paramList.size() > 1) {
            Object errorMsgObj = paramList.get(1);
            if (errorMsgObj instanceof String) {
                errorMsg = (String) errorMsgObj;
            }
        }
    }

    @Override
    public String getRuleName() {
        return ruleName;
    }

    @Override
    public void setRuleName(String ruleName) {
        this.ruleName = ruleName;
    }

    @Override
    public String getErrorMsg() {
        return errorMsg;
    }

}
